// pages/personal/personal.js
//获取应用实例
const storage = require('../../utils/storage');
const app = getApp();
const api = require('../../utils/api');
const constant = require('../../utils/constant');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    //获取全局变量 导航栏的高度statusBarHeight
    statusBarHeight: app.globalData.statusBarHeight,
    // 胶囊
    jiaonang: app.globalData.jiaonang, 
    navigationHeight: app.globalData.navigationHeight,
    BASEURLWWW:constant.BASEURLWWW,
    // 登录状态
    loginStatus: wx.getStorageSync(storage.LOGINSTATUS),
    // 用户信息
    nickName: '',
    avatarUrl: '',
    // 猜你喜欢
    guess:[
      {id:1,describe: '五粮液 新品汇聚五粮精华 浓香佳酿',img: '../../assets/img/hot1.png',price: '8811.00'},
      {id:2,describe: '五粮精华 浓香佳酿',img: '../../assets/img/hot1.png',price: '8821.00'},
      {id:3,describe: '盛唐名酒 代代相传',img: '../../assets/img/hot1.png',price: '8831.00'},
      {id:4,describe: '大牌名酒 新品汇聚',img: '../../assets/img/hot1.png',price: '8841.00'},
    ],
    // 猜你喜欢分页
    pagination:{
      pageNum: 1,  //分页初始值，页号1
      pageSize: 10, //分页初始值，每页20条
      total: null
    }
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    if (typeof this.getTabBar === 'function' &&
      this.getTabBar()) {
      this.getTabBar().setData({
        selected: 3
      })
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },
  // 返回上一级
  back:function(){
    wx.navigateBack({
      delta: 1
    })
  },
  // 跳转到通讯录
  jumpToMailList(){
    wx.reLaunch({
      url: '/pages/mailList/mailList',
    })
  },
  // 跳转到设置
  jumpToPersonalSet:function(e){
    wx.reLaunch({
      url: '/pages/personalSet/personalSet'
    })
  },
  // 跳转到订单
  jumpToOrder:function(e){
    wx.reLaunch({
      url: '/pages/order/order?current='+e.currentTarget.dataset.current
    })
  },
  // 到我的地址
  jumpToAddress: function(e){
    wx.reLaunch({
      url: '/pages/address/address'
    })
  },
  // 跳转到评价
  jumpToEvaluate:function(e){
    // wx.reLaunch({
    //   url: '/pages/myEvaluate/myEvaluate'
    // })
  },
  // 跳转到售后
  jumpToAfterSales:function(){
    wx.reLaunch({
      url: '/pages/afterSales/afterSales'
    })
  },
  // 切换用户
  jumpTologin:function(e){
    wx.reLaunch({
      url: '/pages/login/login?route="/pages/personal/personal"',
    })
  },
  // 猜你喜欢商品跳转
  jumpToGoodsDetail:function(e){
    let goods_id = e.currentTarget.dataset.goodsid;
    wx.navigateTo({
      url: `/pages/goods/goods?goods_id=${goods_id}`,
    })
  },
  // 跳转到评价
  jumpToMyEvaluate:function(e){
    wx.reLaunch({
      url: '/pages/myEvaluate/myEvaluate'
    })
  },
  // 跳转到开通服务
  jumpToOpenService:function(){
    wx.reLaunch({
      url: '/pages/service/service'
    })
  },
  // 跳转到收藏
  jumpToCollection:function(){
    wx.reLaunch({
      url: '/pages/collection/collection'
    })
  },
  // 退出登陆
  logout:function(){
    wx.setStorageSync(storage.LOCAL_JWT_KEY, '')
    wx.reLaunch({
      url: '/pages/login/login',
    })
  }
})